<% if not request.xhr? %>
<table class="ajax-scaffold" cellpadding="0" cellspacing="0">
  <tbody>
<% end %>
<tr id="<%= "edit-tag-#{@tag.id}" %>" class="edit" <%= "style=\"display: none;\"" if request.xhr? %> >
	<td colspan="<%= num_columns %>">
		<%= form_remote_tag :url => { :controller => 'tags', :action => 'update', :id => @tag },
  		                   :loading => "AjaxScaffold.updateOnLoading(request,'tag',#{@tag.id});", 
		                     :success => "AjaxScaffold.updateOnSuccess(request,'tag',#{@tag.id});", 
		                     :failure => "AjaxScaffold.updateOnFailure(request,'tag',#{@tag.id});", 
		                     :html => { :action => url_for(:controller => 'tags', :action => 'update', :id => @tag),
		                                :id => "edit-tag-#{@tag.id}-form" } %>
  	  <h4>Edit Tag</h4>
  	
      <% # Its actually okay to leave both of these elements (ex: form_errors will only generate HTML when in fallback mode) %>
      <% if request.xhr? %>
        <div id="<%= "update-tag-#{@tag.id}-errors" %>" style="display: none;" ></div>
      <% else %>
        <%= render :partial => 'form_errors' %>
      <% end %>

  	  <%= render :partial => 'form' %>
  	
  	  <p>
  	  	<%= submit_tag "Update", :class => "submit" %>
  	  	<%= link_to_function "Cancel", "AjaxScaffold.updateOnCancel('tag',#{@tag.id});",
	                              :href => url_for(:controller => 'tags', :action => 'return_to_main') %>
  	  	<%= loading_indicator_tag 'tag', "update-#{@tag.id}" %>
  	  </p>
  	<%= end_form_tag %>
	</td>
</tr>
<% if not request.xhr? %>
  </tbody>
</table>
<% end %>